from models.objectId import objectId
import hashlib
import time

class spiderurl(objectId):
    def __init__(self):
        super(spiderurl,self).__init__()
        self.model["url"]=None
        self.model["title"]=None
        self.model["lastgettime"]=None
        self.model["hashMD5"]=None

    @property
    def url(self):
        return self.model["url"]
    @url.setter
    def url(self,args):
        self.model["url"]=args

    @property
    def title(self):
        return self.model["title"]

    @title.setter
    def title(self,args):
        self.model["title"]=args

    @property
    def lastGetTime(self):
        return self.model["lastgettime"]
    @lastGetTime.setter
    def lastGetTime(self,args):
        self.model["lastgettime"]=args

    @property
    def hashMD5(self):
        return self.model["hashMD5"]
    @hashMD5.setter
    def hashMD5(self,args):
        if args:
            self.model["hashMD5"]=hashlib.md5(args.encode("utf-8")).hexdigest()
        else:
            self.model["hashMD5"]=None